import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/rb-oem/oem/optimizeMerchantInfo/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}

export const addMerchant = (data) => {
  return request({
    url: '/api/rb-oem/oem/optimizeMerchantInfo/addMerchant',
    method: 'post',
    data
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/rb-oem/oem/optimizeMerchantInfo/delete',
    method: 'get',
    params: {
      ids,
    }
  })
}

export const uploadFile = (file, type, merchantDate) => {
  const formData = new FormData();
  formData.append('file', file);
  formData.append('type', type);
  formData.append('merchantDate', merchantDate);
  return request({
    headers: {
      "Content-Type": "multipart/form-data"
    },
    url: '/api/rb-oem/oem/optimizeMerchantInfo/import',
    method: 'post',
    data: formData
  })
}
/* 导出模板 */
export const getExportTemplate = (params) => {
  return request({
    headers: {
      "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    },
    responseType: 'blob',
    url: '/api/rb-oem/oem/optimizeMerchantInfo/export-template',
    method: 'get',
    params: {
      ...params,
    }
  })
}
